﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace DAL
{
    public static class sqlHelper
    {
        static string sqlcon = @"Data Source=.;Initial Catalog=Manage;Integrated Security=True";
        static SqlConnection conn = new SqlConnection(sqlcon);

        public static DataTable getTable(string sqlstr)
        {
            try
            {
                conn.Open();
                SqlDataAdapter ad = new SqlDataAdapter(sqlstr, conn);
                DataTable dt = new DataTable();
                ad.Fill(dt);
                return dt;
            }
            catch
            {
                return null;
            }
            finally
            {
                conn.Close();
            }
        }
        
    }
}
